<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace app\admin\model;

class ShopOrder extends \app\BaseModel
{
    protected $name = "longbing_card_shop_order";
    protected $append = ["goods_text"];
    protected static function init()
    {
    }
    public function getGoodsTextAttr($value, $data)
    {
        $orer_goods = new ShopOrderGoods();
        $dis["order_id"] = $data["id"];
        return $orer_goods->orderGoodsInfo($dis);
    }
    public function orderList($dis, $page = 10)
    {
        $data = self::where($dis)->paginate($page)->toArray();
        return $data;
    }
    public function orderUpdate($dis, $data)
    {
        $data["update_time"] = time();
        $res = self::where($dis)->update($data);
        return $res;
    }
    public function orderInfo($dis, $field = "*")
    {
        $data = self::where($dis)->field($field)->find();
        return !empty($data) ? $data->toArray() : $data;
    }
    public function getCompanyPrice($company_id, $start, $end)
    {
        return $this->whereIn("company_id", $company_id)->whereBetween("create_time", [$start, $end])->where("pay_status", 1)->where("order_status", 3)->sum("total_price");
    }
}

?>